package StudyCode.summary.myfile;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class DeserializeObjectFromFile {

	public static void main(String[] args) {
		System.out.println(deserialize("E:/Copy/1.txt"));
	}

	private static Object deserialize(String filename) {
		System.out.println("开始反序列化 " + filename);
		Object object = null;

		try {
			FileInputStream fileIn = new FileInputStream(filename);
			ObjectInputStream in = new ObjectInputStream(fileIn);
			object = in.readObject();
			in.close();
			fileIn.close();
		} catch (IOException | ClassNotFoundException ignored) {

		}

		System.out.println("反序列化结束 " + filename);
		return object;
	}
}
